package fr.cnam.ratpProject.client.activities.searchStation;

import java.util.ArrayList;

import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.googlecode.mgwt.ui.client.widget.ScrollPanel;

import fr.cnam.ratpProject.client.activities.searchStation.ShowStation.ShowStationView;
import fr.cnam.ratpProject.client.css.AppBundle;
import fr.cnam.ratpProject.sharedDatas.Ligne;
import fr.cnam.ratpProject.sharedDatas.Station;

public class ShowStationViewImpl extends Composite implements ShowStationView {

	private VerticalPanel main = new VerticalPanel();
	
	
	private Label title = new Label();
	
	private ArrayList<LinePanel> pnlImg = new ArrayList<LinePanel>();
	
	public ShowStationViewImpl()
	{
		initWidget(main);
		main.add(title);
		main.add(new LinePanel());

	}

	@Override
	public void buildView(Station station, ArrayList<Ligne> lignes) {
		if(station !=null)
		{
			title.setText(station.getName());
		}
		
		for(Ligne ligne:lignes)
		{
			LinePanel lignepnl = new LinePanel(ligne);
			
//			ScrollPanel pnl = new ScrollPanel();
//			
//			
//			pnl.add(getImage(ligne.getIdLigne()));
//			
//			
//			pnl.setSize("550px", "550px");
//			
//			pnl.setScrollingEnabledX(true);
//			pnl.setShowScrollBarX(true);
			
		}
		
		
	}
	
	private Image getImage(String id)
	{
		Image img = null;
		
		if(id.equals("1"))
		{
			img = new Image(AppBundle.INSTANCE.ligne1());
		}
		else if(id.equals("2"))
		{
			img = new Image(AppBundle.INSTANCE.ligne2());
		}
		else if(id.equals("3") || id.equals("18"))
		{
			img = new Image(AppBundle.INSTANCE.ligne3());
		}
		else if(id.equals("4"))
		{
			img = new Image(AppBundle.INSTANCE.ligne4());
		}
		else if(id.equals("5"))
		{
			img = new Image(AppBundle.INSTANCE.ligne5());
		}
		else if(id.equals("6"))
		{
			img = new Image(AppBundle.INSTANCE.ligne6());
		}
		else if(id.equals("7") || id.equals("16")|| id.equals("17"))
		{
			img = new Image(AppBundle.INSTANCE.ligne7());
		}
		else if(id.equals("8"))
		{
			img = new Image(AppBundle.INSTANCE.ligne8());
		}
		else if(id.equals("9"))
		{
			img = new Image(AppBundle.INSTANCE.ligne9());
		}
		else if(id.equals("10") || id.equals("11"))
		{
			img = new Image(AppBundle.INSTANCE.ligne10());
		}
		else if(id.equals("12"))
		{
			img = new Image(AppBundle.INSTANCE.ligne11());
		}
		else if(id.equals("13"))
		{
			img = new Image(AppBundle.INSTANCE.ligne12());
		}
		else if(id.equals("14"))
		{
			img = new Image(AppBundle.INSTANCE.ligne13());
		}
		else if(id.equals("15")) {
			
			img = new Image(AppBundle.INSTANCE.ligne14());
		}
		
		return img;
	}

}
